import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import million from 'million/compiler';
import path from 'path';
import { pluginLightningcss } from '@rsbuild/plugin-lightningcss';
import { pluginImageCompress } from '@rsbuild/plugin-image-compress';

export default defineConfig({
  dev: {
    progressBar: true,
  },
  performance: {
    removeConsole: ['log', 'warn'],
    chunkSplit: {
      strategy: 'split-by-experience',
    }
  },
  html:{
    favicon: path.resolve(__dirname,'./public/favicon.svg')
  },
  tools: {
    rspack: (config, { appendPlugins }) => {
      appendPlugins([
        million.rspack({ auto: true })
      ])
    },
  },
  plugins: [pluginReact(), pluginLightningcss(), pluginImageCompress()],
  source: {
    alias: {
      '@': './src',
      'assets': './src/assets',
      'components': './src/components',
    },
  },
});